import 'package:eh_mobile/pages/main/smart_home_info/widgets/staggered_draggable_sort.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'index.dart';

class MessagePage extends GetView<MessageController> {
  MessagePage({super.key});

  final List<String> _images = [
    "assets/images/gmzr1.jpg",
    "assets/images/gmzr2.jpg",
    "assets/images/gmzr3.jpg",
    "assets/images/gmzr4.jpg",
  ];
  List<StaggeredItem> staggeredList = [
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 1,
        crossAxisCellCount: 2,
        child: Container(color: Colors.blue)),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 1,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.yellow,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 2,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.cyan,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 1,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.yellow,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 2,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.orange,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 2,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.cyan,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 1,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.yellow,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 2,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.cyan,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 1,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.yellow,
        )),
    StaggeredItem(
        key: '0',
        mainAxisCellCount: 2,
        crossAxisCellCount: 2,
        child: Container(
          color: Colors.orange,
        )),
  ];

  // 主视图
  Widget _buildView() {
    return SingleChildScrollView(
      child: Column(
        children: [
          StaggeredDraggableSortView(
            staggeredModelList: staggeredList,
            aspectRatio: 0.8,
          ),
          Container(
            margin: const EdgeInsets.only(top: 20),
            width: 200,
            height: 50,
            color: Colors.red,
            child: const Center(
              child: Text('底部视图'),
            ),
          )
        ],
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return GetBuilder<MessageController>(
      init: MessageController(),
      id: "message",
      builder: (_) {
        return Scaffold(
          appBar: AppBar(title: const Text("推送信息")),
          body: SafeArea(
            child: _buildView(),
          ),
        );
      },
    );
  }
}
